﻿using System.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Stats;
//using System.Threading;
using System.IO;

namespace StatsTest
{
    class Program
    {
        static void Main(string[] args)
        {

            Stats.StatsModule.Init(@"..\..\..\..\GUI\App_Data\DataFile.xml");

            StatsModule.startStatsDaemon();
            
            //Console.WriteLine(DateTime.Today.AddMonths(-1));

            //int userID = 303;  //con 4 stage nel trip 297   

            //Console.WriteLine(StatsModule.setUserVehicleType(432, StatsModule.SedanCarVehicleType));

            //Console.WriteLine(StatsModule.getUserVehicleType(432));

            //StatsModule.deleteUserPendingFeedbacksOnCancellingFromTrip(670, 432);
            
            //StatsModule.updateGeneralStats();

            //DateTime d = new DateTime(2009, 01, 22);
            //UpdateDailyStatsTableModule.updateDailyStatsTable(d);

            //bool b = StatsModule.deletePendingFeedbacksFromThisUserForTrip(678, 1056);

            //System.Console.WriteLine(StatsModule.insertNegativeFeedbackForOwner(678, 1055, 675));
            //System.Console.WriteLine(StatsModule.insertNegativeFeedbackForPassenger(678, 1056, 675));
            //

            //Stats.Objects.GeneralFeedback o = Stats.StatsModule.getGeneralFeedback(671);
            //Console.WriteLine(o.Reliability.ToString().Remove(3));

           

            //StatsModule.startStatsDaemon();

            //StatsModule.updateGeneralStats();

            //StatsModule.getLastNRegisteredUsers(5);

            //Console.WriteLine("JOIN DELL'UTENTE 308 sul viaggio 255 (owner 302)");

            //StatsModule.insertPendingFeedbacksOnJoin(255, 308);

            //Console.WriteLine("USER 308 DEVE LASCIARE:");

            

            //AuxSavingsMethods.getEmissionsSavedInTrip(1055);

            //StatsModule.startStatsDaemon();

            //Stats.Objects.ReleasedFeedback fdb = new Stats.Objects.ReleasedFeedback(680, 671, 7, 8, 9, 5, "utente gentile e disponibile", 1055, 0, true);

            ////Console.WriteLine("RILASCIATO FEEDBACK DA 308 a 302");

            //StatsModule.insertReleasedFeedback(fdb);

            //ReleasedFeedback fdb2 = new ReleasedFeedback(302, 308, 5, 4, 7, 0, "Ottimo passeggero", 255, 1, true);

            //Console.WriteLine("RILASCIATO FEEDBACK DA 302 a 308");

            //StatsModule.insertReleasedFeedback(fdb2);

            //Console.WriteLine("USER 308 ADESSO DEVE LASCIARE:");

            //StatsModule.getPendingFeedbacks(308);

            //Console.WriteLine("USER 302 ADESSO DEVE LASCIARE:");

            //StatsModule.getPendingFeedbacks(308);

            //AuxUserMethods.getUserAsDriverPacksCount(userID);
            //AuxUserMethods.getUserAsPassengerPacksCount(userID);

            //AuxTripMethods.getTripDepartureDate(255);
            //AuxTripMethods.getTripOwnerID(253);

            //int userID

            //int stageID = 44;

            //DateTime dateToAdd = new DateTime(2009, 05, 17);
            //Stats.UpdateDailyStatsTableModule.updateDailyStatsTable(dateToAdd,false,false);

            //Tests.testGetUserGeneralFeedback(userID);

            //Tests.testGetUserAsDriverFeedback(userID);

            //Tests.testGetUserAsPassengerFeedback(userID);

            //Tests.testGetUserFeedbackList(671);

            //ConfigurationData c = new ConfigurationData("DataFile.xml");
            //Console.WriteLine(c.FuelCostPerLiterReference);


            //Tests.testGetGeneralStats();

            //Tests.testUpdateUserAsDriverFeedback(userID, 6, 7, 8, 9);
            //Tests.testUpdateUserAsPassengerFeedback(userID, 4, 9, 7);


            //Tests.testGetUserTotalPassengersCarried(userID);
            ////Tests.testGetUserTotalPassengersCarriedOnTheWay(userID);
            //Tests.testGetUserMaxPassengers(userID);


            //Tests.testGetUserTripsAsDriverNumber(userID);
            //Tests.testGetUserTripsAsPassengerNumber(userID);

            //Tests.testGetUserTripsProposedNumber(userID);


            //Tests.testGetUserTotalKmAsDriver(userID);
            //Tests.testGetUserTotalKmAsPassenger(userID);

            //Tests.testGetUserProfile(432);

            /*
            
            Tests.testGetStageKm(stageID);

             //* 
             //* 
             // *  * */

            //System.Console.WriteLine(AuxMethods.getTripKm(67));

            //double p = AuxUserMethods.getUserTripsProposedNumber(userID);



            //System.Console.WriteLine(AuxMethods.getTripKm(13));

            //double kmSav = AuxMethods.totalKmSaved();

            //System.Console.WriteLine("km saved: " + kmSav);

            //System.Console.WriteLine("fuel saved: " + AuxMethods.fuelSaved(kmSav, 1));

            //System.Console.WriteLine("environment saved: " + AuxMethods.environmentSaved(AuxMethods.fuelPerKm(kmSav)));

            //System.Console.WriteLine("better one: " + AuxMethods.pollutionSaved(200, 1));

            //System.Console.WriteLine(AuxMethods.pollutionSavedInTrip(67));

            //int[] res = ReadDailyStatsTableModule.getMonthStats("savedMoney", 2008, 1);
            //for (int i = 0; i < 31; i++)
            //{
            //    System.Console.WriteLine("giorno=" + i + " dato=" + res[i]);
            //}
            //System.Console.ReadLine();



            //DataBasePopulator.populateDailyTable();



            //    string prova = "aaa";
            //  System.Console.WriteLine((bool)("aaa" == prova));

            //string lang = "it-IT";
            //System.Resources.ResourceManager rm = new System.Resources.ResourceManager("Month", System.Reflection.Assembly.GetExecutingAssembly(), null);

            //XmlTextReader reader = new XmlTextReader("language." + lang + ".xml");

            //reader.Read();
            //try
            //{
            //    XmlReader rdr = XmlReader.Create("sticazzi.icsml.xml");
            //}
            //catch (FileNotFoundException e)
            //{
            //    Console.WriteLine("error");
            //}
            

            //while (reader.Read())
            //{
            //    switch (reader.NodeType)
            //    {
            //        case XmlNodeType.Element: // The node is an element.
            //            Console.Write("<" + reader.Name);
            //            Console.WriteLine(">");
            //            Console.Write("attributo:\"" + reader.GetAttribute("name"));
            //            Console.WriteLine("\"");
            //            break;
            //        case XmlNodeType.Text: //Display the text in each element.
            //            Console.WriteLine(reader.Value);
            //            break;
            //    }
            //}


            //string[] monthLabels = new string[12];
            //switch (lang)
            //{
            //    case "it":
            //        System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("it-IT");
            //        for (int i = 0; i < 12; i++)
            //            monthLabels[i] = rm.GetString("0", ci);
            //        break;
            //}

            //foreach (string mese in monthLabels)
            //    System.Console.WriteLine(mese);

            //int psnCount = AuxUserMethods.getUserTotalCarriedPassengersCount(775);
            //Console.WriteLine(psnCount);

            //psnCount = AuxUserMethods.getPassengersCarriedOnTheWayCount(775);
            //Console.WriteLine(psnCount);

            Console.ReadLine();

                        
        }

    }
}
